<?php


namespace Applications\controllers;


use GatewayWorker\Lib\Gateway;

class Send
{
    public function to($param)
    {
        if (isset($param['uid']) && isset($param['content'])) {
            Gateway::sendToUid($param['uid'], json_encode($param['content']) . "\r\n");
            return true;
        }

        return json_encode(['status' => 1, 'msg' => 'parameter error']);
    }

    public function toAll($param)
    {
        if (isset($param['content'])) {
            Gateway::sendToAll(json_encode($param['content']));
            return true;
        }

        return json_encode(['status' => 1, 'msg' => 'parameter error']);
    }
}